package com.scsystem.xysc.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDate;
import lombok.Data;

/**
 * 商铺数据
 * @TableName store_data
 */
@TableName(value ="store_data")
@Data
public class StoreData implements Serializable {

    /**
     * 店铺数据表ID
     */
    @TableId(value = "store_data_id", type = IdType.AUTO)
    private Long StoreDataID;
    /**
     * 标识店铺的ID
     */
    @TableField(value = "store_id")
    private Long storeId;

    /**
     * 访客的IP（当日重复访问不计入）
     */
    @TableField(value = "user_ip")
    private String userIp;

    /**
     * 是否成交（是 or 否）
     */
    @TableField(value = "is_deal")
    private String isDeal;

    /**
     * 该IP当日访问此店铺的次数
     */
    @TableField(value = "visits")
    private Integer visits;

    /**
     * 时间
     */
    @TableField(value = "access_date")
    private LocalDate accessDate;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        StoreData other = (StoreData) that;
        return (this.getStoreId() == null ? other.getStoreId() == null : this.getStoreId().equals(other.getStoreId()))
            && (this.getUserIp() == null ? other.getUserIp() == null : this.getUserIp().equals(other.getUserIp()))
            && (this.getIsDeal() == null ? other.getIsDeal() == null : this.getIsDeal().equals(other.getIsDeal()))
            && (this.getVisits() == null ? other.getVisits() == null : this.getVisits().equals(other.getVisits()))
            && (this.getAccessDate() == null ? other.getAccessDate() == null : this.getAccessDate().equals(other.getAccessDate()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getStoreId() == null) ? 0 : getStoreId().hashCode());
        result = prime * result + ((getUserIp() == null) ? 0 : getUserIp().hashCode());
        result = prime * result + ((getIsDeal() == null) ? 0 : getIsDeal().hashCode());
        result = prime * result + ((getVisits() == null) ? 0 : getVisits().hashCode());
        result = prime * result + ((getAccessDate() == null) ? 0 : getAccessDate().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", storeId=").append(storeId);
        sb.append(", userIp=").append(userIp);
        sb.append(", isDeal=").append(isDeal);
        sb.append(", visits=").append(visits);
        sb.append(", accessDate=").append(accessDate);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}